//
// Created on 2024/4/29.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef DIANPING_CAPI_DEMO_WATERFLOWNODE_H
#define DIANPING_CAPI_DEMO_WATERFLOWNODE_H

#include "ArkUINode.h"
#include "NativeNodeApi.h"
#include <arkui/native_node.h>
#include <bits/alltypes.h>

class WaterFlowNodeScrollDelegate {
public:
    virtual ~WaterFlowNodeScrollDelegate() = default;
    virtual void onScroll(){};
    virtual void onScrollStart(){};
    virtual void onScrollStop(){};
    virtual float onScrollFrameBegin(float offset, int32_t scrollState) { return offset; };
};

class WaterFlowNode : public ArkUINode {
protected:
    WaterFlowNodeScrollDelegate *m_waterFlowNodeDelegate;
    ArkUI_NodeAdapterHandle m_adapter;

public:
    WaterFlowNode();
    ~WaterFlowNode();

    WaterFlowNode &setAdapter(ArkUI_NodeAdapterHandle adapter);
    void onNodeEvent(ArkUI_NodeEventType eventType, EventArgs &eventArgs);
    WaterFlowNode &setLayoutDirection(int direction);
    void insertChild(ArkUINode &child, std::size_t index);
    void removeChild(ArkUINode &child);
    // 懒加载属性设置，表示预创建出多少个节点
    WaterFlowNode &setCacheCount(int count);
    WaterFlowNode &setScrollBarDisplayMode(ArkUI_ScrollBarDisplayMode scrollBarDisplayMode);
    WaterFlowNode &setScrollBarColor(uint32_t scrollBarColor);
    void setNestedScrollMode(ArkUI_ScrollNestedMode scrollNestedMode);
    WaterFlowNode &setEnableScrollInteraction(bool enableScrollInteraction);
    void scrollTo(float x, float y, bool animated);
    void setNodeScrollDelegate(WaterFlowNodeScrollDelegate *listNodeDelegate);
};


#endif //DIANPING_CAPI_DEMO_WATERFLOWNODE_H
